<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-CH">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/niko/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/niko/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/niko/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/niko/favicon.ico?v=5.1.1" />






<meta name="description" content="3.初始化工程初始化工程 这里，我尝试用简单的方式来说明一个工程的构建。然后，再将简单的方式工程化（复杂化），最后拼凑成目前weex开源的代码结构。    安装weex-toolkit 这里要说明的是，目前最新版本的weex-toolkit0.5.2有bug,babel组件丢失的问题，解决办法可以添加babel组件依赖，也可以降级weex-toolkit 下面是此问题的issue WeexBabe">
<meta property="og:type" content="article">
<meta property="og:title" content="NikoBlog">
<meta property="og:url" content="http://git.oschina.net/280772270/niko/2017/06/20/3.初始化工程/index.html">
<meta property="og:site_name" content="NikoBlog">
<meta property="og:description" content="3.初始化工程初始化工程 这里，我尝试用简单的方式来说明一个工程的构建。然后，再将简单的方式工程化（复杂化），最后拼凑成目前weex开源的代码结构。    安装weex-toolkit 这里要说明的是，目前最新版本的weex-toolkit0.5.2有bug,babel组件丢失的问题，解决办法可以添加babel组件依赖，也可以降级weex-toolkit 下面是此问题的issue WeexBabe">
<meta property="og:image" content="http://git.oschina.net/280772270/niko/2017/06/20/3.初始化工程/resources/C0BBB74BD2AB01B005799E3C19DA4B42.png">
<meta property="og:image" content="http://git.oschina.net/280772270/niko/2017/06/20/3.初始化工程/resources/17938710144706F3052DDAFA73DEE6D4.png">
<meta property="og:image" content="http://git.oschina.net/280772270/niko/2017/06/20/3.初始化工程/resources/8EB8FDA4F1641F3B97F9A7C04E8E0A78.png">
<meta property="og:updated_time" content="2017-06-20T02:27:12.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="NikoBlog">
<meta name="twitter:description" content="3.初始化工程初始化工程 这里，我尝试用简单的方式来说明一个工程的构建。然后，再将简单的方式工程化（复杂化），最后拼凑成目前weex开源的代码结构。    安装weex-toolkit 这里要说明的是，目前最新版本的weex-toolkit0.5.2有bug,babel组件丢失的问题，解决办法可以添加babel组件依赖，也可以降级weex-toolkit 下面是此问题的issue WeexBabe">
<meta name="twitter:image" content="http://git.oschina.net/280772270/niko/2017/06/20/3.初始化工程/resources/C0BBB74BD2AB01B005799E3C19DA4B42.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/niko/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://git.oschina.net/280772270/niko/2017/06/20/3.初始化工程/"/>





  <title> | NikoBlog</title>
  














</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CH">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/niko/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">NikoBlog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">TecBlog</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/niko/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Startseite
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/niko/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archiv
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/niko/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            Tags
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://git.oschina.net/280772270/niko/niko/2017/06/20/3.初始化工程/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Yifei's">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/niko/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="NikoBlog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline"></h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Veröffentlicht am</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2017-06-20T10:27:12+08:00">
                2017-06-20
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="3-初始化工程"><a href="#3-初始化工程" class="headerlink" title="3.初始化工程"></a>3.初始化工程</h1><h2 id="初始化工程"><a href="#初始化工程" class="headerlink" title="初始化工程"></a>初始化工程</h2><p> 这里，我尝试用简单的方式来说明一个工程的构建。然后，再将简单的方式工程化（复杂化），最后拼凑成目前weex开源的代码结构。   </p>
<h2 id="安装weex-toolkit"><a href="#安装weex-toolkit" class="headerlink" title="安装weex-toolkit"></a>安装weex-toolkit</h2><p> <strong>这里要说明的是，目前最新版本的weex-toolkit0.5.2有bug,babel组件丢失的问题，解决办法可以添加babel组件依赖，也可以降级weex-toolkit</strong><br> <strong>下面是此问题的issue</strong><br> <a href="https://github.com/alibaba/weex/issues/1218" target="_blank" rel="external">WeexBabelError issue</a><br>weex-toolkit是一个很好的工具供我们工程构建。首先，第一步是安装该工具：   </p>
<pre><code>$npm install -g weex-toolkit       
</code></pre><p>测试weex-toolkit是否安装成功，可以使用如下命令测试：       </p>
<pre><code>$ weex --version       
info 0.4.4      
</code></pre><p>如果显示版本号即为成功。         </p>
<p>###weex-toolkit常用命令</p>
<ol>
<li>–qr :显示二维码</li>
<li>-o   ：把weex文件渲染成js</li>
<li>weex $filename :在浏览器查看we的效果</li>
</ol>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div></pre></td><td class="code"><pre><div class="line">^Cbogon:WeexProj Tec_yifei$ weex</div><div class="line">info </div><div class="line">Usage: weex foo/bar/we_file_or_dir_path  [options]</div><div class="line">Usage: weex init</div><div class="line"></div><div class="line">选项：</div><div class="line">  --qr          display QR code for native runtime, default action     [boolean]</div><div class="line">  -o, --output  transform weex we file to JS Bundle, output path must specified</div><div class="line">                (single JS bundle file or dir)</div><div class="line">                [for create sub cmd]it specified we file output path</div><div class="line">                                                  [默认值: "no JSBundle output"]</div><div class="line">  --watch       using with -o , watch input path , auto run transform if change</div><div class="line">                happen</div><div class="line">  -s, --server  start a http file server, weex .we file will be transforme to JS</div><div class="line">                bundle on the server , specify local root path using the option</div><div class="line">                                                                        [string]</div><div class="line">  --port        http listening port number ,default is 8081         [默认值: -1]</div><div class="line">  --wsport      websocket listening port number ,default is 8082    [默认值: -1]</div><div class="line">  --np          do not open preview browser automatic                  [boolean]</div><div class="line">  -f, --force   [for create sub cmd]force to replace exsisting file(s) [boolean]</div><div class="line">  --help        显示帮助信息                                           [boolean]</div><div class="line">  -h, --host                                               [默认值: "127.0.0.1"]</div><div class="line"></div><div class="line">for example &amp; more information visit https://www.npmjs.com/package/weex-toolkit</div></pre></td></tr></table></figure>
<h2 id="创建项目"><a href="#创建项目" class="headerlink" title="创建项目"></a>创建项目</h2><p>这里，我们不再使用weex 跑一个文件的形式。我们需要一个较为完整的方案，因此，这里采用weex init命令创建项目。         </p>
<p>首先，我们创建一个目录存放我们的项目，启动命令行：     </p>
<pre><code>$ mkdir test      
$ cd test    
$ weex init 
    //下面一路回车
    prompt: Project Name:  (test) 
    file: .gitignore created.
    file: README.md created.
    file: index.html created.
    file: package.json created.
    file: src/main.we created.
    file: webpack.config.js created.     
</code></pre><h2 id="跑起项目"><a href="#跑起项目" class="headerlink" title="跑起项目"></a>跑起项目</h2><p>首先，我们需要安装依赖。以后大家看到package.json文件，就可以直接npm install 安装模块了。           </p>
<pre><code>$ npm install 
</code></pre><p>依赖安装完成，启动项目编译。</p>
<pre><code>$ npm run dev       
</code></pre><p> 启动本地服务器。    </p>
<pre><code>$ npm run serve            
</code></pre><p> 这时，打开浏览器，输入<a href="http://127.0.0.1:8080" target="_blank" rel="external">http://127.0.0.1:8080</a>, 就会看到如下界面效果:       </p>
<p><img src="resources/C0BBB74BD2AB01B005799E3C19DA4B42.png" alt="003\_1.png"></p>
<h2 id="npm-run-dev干了什么事儿"><a href="#npm-run-dev干了什么事儿" class="headerlink" title="npm run dev干了什么事儿"></a>npm run dev干了什么事儿</h2><p>这一些都是node/npm的常识了（所以对于萌新来说这都是坑）。首先，我们打开package.json文件。可以看到如下代码：     </p>
<p><img src="resources/17938710144706F3052DDAFA73DEE6D4.png" alt="QQ20160926-3.png"></p>
<p> 我们可以看到scripts里面包含了build、dev、serve、test四个属性。例如dev属性,npm run dev实际上相当于 webpack –watch。即等同开发者做了这件事:   </p>
<pre><code>$ webpack --watch        
</code></pre><p> ok，看到这里明白了。npm run dev调用了webpack。那么，webpack实际上是执行了配置文件。<br> webpack默认是webpack.config.js作为配置文件的。所以看一下webpack.config.js中的内容。       </p>
<p><strong>关于webpack的学习资料</strong><br><a href="https://segmentfault.com/a/1190000002551952" target="_blank" rel="external">webpack入门指迷</a></p>
<p><img src="resources/8EB8FDA4F1641F3B97F9A7C04E8E0A78.png" alt="QQ20160926-4.png"></p>
<p>  这个文件比较好理解。一个是引入了webpack的配置，一个是使用了weex-loader模块。<br>  entry属性是表示入口文件，output表示输出文件，默认输出到dist文件夹。所有打开dist就可以看到一个打包完成的main.js文件。      </p>
<h2 id="npm-run-serve"><a href="#npm-run-serve" class="headerlink" title="npm run serve"></a>npm run serve</h2><p>这个同上，主要是做一个服务器，提供浏览器访问静态资源。     </p>
<h2 id="入口文件index-html"><a href="#入口文件index-html" class="headerlink" title="入口文件index.html"></a>入口文件index.html</h2><p>是时候，去了解我们index.html文件干了一件啥事。其实，index.html就是页面的入口文件。具体大码如下：            </p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div></pre></td><td class="code"><pre><div class="line"><span class="meta">&lt;!DOCTYPE html&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">html</span>&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"utf-8"</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">title</span>&gt;</span>Weex HTML5<span class="tag">&lt;/<span class="name">title</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"apple-mobile-web-app-capable"</span> <span class="attr">content</span>=<span class="string">"yes"</span> /&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"apple-mobile-web-app-status-bar-style"</span> <span class="attr">content</span>=<span class="string">"black"</span> /&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"apple-touch-fullscreen"</span> <span class="attr">content</span>=<span class="string">"yes"</span> /&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"format-detection"</span> <span class="attr">content</span>=<span class="string">"telephone=no, email=no"</span> /&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">style</span>&gt;</span><span class="undefined"></span></div><div class="line">    html, body, #weex &#123;</div><div class="line">      width: 100%;</div><div class="line">      height: 100%;</div><div class="line">    &#125;</div><div class="line">  <span class="tag">&lt;/<span class="name">style</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">"./node_modules/weex-html5/dist/weex.js"</span>&gt;</span><span class="undefined"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></div><div class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">"weex"</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></div><div class="line">  <span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="undefined"></span></div><div class="line">  /**</div><div class="line">   * Init weex instance depending on the url params.</div><div class="line">   * There are three ways to load weex bundles, depends on the</div><div class="line">   * parameter 'loader' in the url:</div><div class="line">   *</div><div class="line">   *   + xhr: use XMLHttpRequest. Parameter 'page' should be</div><div class="line">   *   the bundle's url.</div><div class="line">   *   + source: use the transformed code itself. 'page' should</div><div class="line">   *   be the transformed weex bundle.</div><div class="line">   *</div><div class="line">   * @param &#123;String&#125; bundle - It has different meaning depends on</div><div class="line">   *   the type of loader.</div><div class="line">   */</div><div class="line">  (function () &#123;</div><div class="line">    function getUrlParam (key) &#123;</div><div class="line">      var reg = new RegExp('[?|&amp;]' + key + '=([^&amp;]+)')</div><div class="line">      var match = location.search.match(reg)</div><div class="line">      return match &amp;&amp; match[1]</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    var loader = getUrlParam('loader') || 'xhr'</div><div class="line">    var page = getUrlParam('page') || 'dist/main.js'</div><div class="line"></div><div class="line">    window.weex.init(&#123;</div><div class="line">      appId: location.href,</div><div class="line">      loader: loader,</div><div class="line">      source: page,</div><div class="line">      rootId: 'weex'</div><div class="line">    &#125;)</div><div class="line">  &#125;)();</div><div class="line">  <span class="tag">&lt;/<span class="name">script</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></div><div class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></div></pre></td></tr></table></figure>
<p>作为入口和载体，html做了两件事：<br>1) 拿到页面的URL，根据page参数获得需要加载的js文件路径<br>2）初始化weex实例，加载文件。<br>此处文章可参考：<a href="http://alibaba.github.io/weex/doc/advanced/integrate-to-html5.html" target="_blank" rel="external">http://alibaba.github.io/weex/doc/advanced/integrate-to-html5.html</a>     </p>
<h2 id="更好的理解weex-github源码结构"><a href="#更好的理解weex-github源码结构" class="headerlink" title="更好的理解weex github源码结构"></a>更好的理解weex github源码结构</h2><p>到这里，整个weex项目的来龙去脉，应该是比较清楚了。那么，回过头来看，weex开源代码如何构建，应该是件水到渠成的事了。比如看这段打包的配置代码：<a href="https://github.com/alibaba/weex/blob/dev/build/webpack.examples.config.js" target="_blank" rel="external">https://github.com/alibaba/weex/blob/dev/build/webpack.examples.config.js</a>          </p>
<pre><code class="javascript"><span class="keyword">var</span> path = <span class="built_in">require</span>(<span class="string">'path'</span>);
<span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>);

<span class="keyword">var</span> entry = {};

<span class="function"><span class="keyword">function</span> <span class="title">walk</span>(<span class="params">dir</span>) </span>{
  dir = dir || <span class="string">'.'</span>
  <span class="keyword">var</span> directory = path.join(__dirname, <span class="string">'../examples'</span>, dir);
  fs.readdirSync(directory)
    .forEach(<span class="function"><span class="keyword">function</span>(<span class="params">file</span>) </span>{
      <span class="keyword">var</span> fullpath = path.join(directory, file);
      <span class="keyword">var</span> stat = fs.statSync(fullpath);
      <span class="keyword">var</span> extname = path.extname(fullpath);
      <span class="keyword">if</span> (stat.isFile() &amp;&amp; extname === <span class="string">'.we'</span>) {
        <span class="keyword">var</span> name = path.join(<span class="string">'examples'</span>, <span class="string">'build'</span>, dir, path.basename(file, extname));
        entry[name] = fullpath + <span class="string">'?entry=true'</span>;
      } <span class="keyword">else</span> <span class="keyword">if</span> (stat.isDirectory() &amp;&amp; file !== <span class="string">'build'</span> &amp;&amp; file !== <span class="string">'include'</span>) {
        <span class="keyword">var</span> subdir = path.join(dir, file);
        walk(subdir);
      }
    });
}

walk();

<span class="built_in">module</span>.exports = {
  <span class="attr">entry</span>: entry,
  <span class="attr">output</span> : {
    <span class="attr">path</span>: <span class="string">'.'</span>,
    <span class="attr">filename</span>: <span class="string">'[name].js'</span>
  },
  <span class="attr">module</span>: {
    <span class="attr">loaders</span>: [
      {
        <span class="attr">test</span>: <span class="regexp">/\.we(\?[^?]+)?$/</span>,
        <span class="attr">loader</span>: <span class="string">'weex'</span>
      },
      {
        <span class="attr">test</span>: <span class="regexp">/\.js(\?[^?]+)?$/</span>,
        <span class="attr">loader</span>: <span class="string">'weex?type=script'</span>
      },
      {
        <span class="attr">test</span>: <span class="regexp">/\.css(\?[^?]+)?$/</span>,
        <span class="attr">loader</span>: <span class="string">'weex?type=style'</span>
      }, 
      {
        <span class="attr">test</span>: <span class="regexp">/\.html(\?[^?]+)?$/</span>,
        <span class="attr">loader</span>: <span class="string">'weex?type=tpl'</span>
      }
    ]
  }
}
</code></pre>
<p>就是编译examples目录下所有.we文件到build目录。代码可以细看，都是Node.js File System相关的API.     </p>
<p>###附录</p>
<p>1、<a href="http://zct1989.oschina.io/2016/07/04/weex1/" target="_blank" rel="external">weex环境搭建</a><br>2、<a href="http://zct1989.oschina.io/2016/07/06/weex2/" target="_blank" rel="external">weex的HelloWorld起手式</a></p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/niko/2017/06/20/4.了解工程/" rel="next" title="">
                <i class="fa fa-chevron-left"></i> 
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/niko/2017/06/20/2.初识Weexdemo-Example/" rel="prev" title="">
                 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Inhaltsverzeichnis
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Übersicht
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/niko/images/avatar.gif"
               alt="Yifei's" />
          <p class="site-author-name" itemprop="name">Yifei's</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/niko/archives/">
                <span class="site-state-item-count">7</span>
                <span class="site-state-item-name">Artikel</span>
              </a>
            </div>
          

          

          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#3-初始化工程"><span class="nav-number">1.</span> <span class="nav-text">3.初始化工程</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#初始化工程"><span class="nav-number">1.1.</span> <span class="nav-text">初始化工程</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装weex-toolkit"><span class="nav-number">1.2.</span> <span class="nav-text">安装weex-toolkit</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#创建项目"><span class="nav-number">1.3.</span> <span class="nav-text">创建项目</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#跑起项目"><span class="nav-number">1.4.</span> <span class="nav-text">跑起项目</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#npm-run-dev干了什么事儿"><span class="nav-number">1.5.</span> <span class="nav-text">npm run dev干了什么事儿</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#npm-run-serve"><span class="nav-number">1.6.</span> <span class="nav-text">npm run serve</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#入口文件index-html"><span class="nav-number">1.7.</span> <span class="nav-text">入口文件index.html</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#更好的理解weex-github源码结构"><span class="nav-number">1.8.</span> <span class="nav-text">更好的理解weex github源码结构</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Yifei's</span>
</div>


<div class="powered-by">
  Erstellt mit  <a class="theme-link" href="https://hexo.io">Hexo</a>
</div>

<div class="theme-info">
  Theme -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/niko/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/niko/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/niko/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/niko/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/niko/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/niko/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/niko/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/niko/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/niko/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/niko/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/niko/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
